package main
import(
	"fmt"
	"math/rand"
	"time"
)
func sumArray(a [10]int)int{
	var sum int = 0
	for _,value := range a{
		sum = sum + value
	}

	return sum
}
func testArraySum()  {
	rand.Seed(time.Now().Unix())
	var b [10]int
	for i := 0 ; i < len(b); i++{
		b[i] = rand.Intn(1000)
		// b[i] = rand.Int()
	}
	sum:=sumArray(b)
	fmt.Printf("sum=%d\n",sum)
}

func TwoSum(a [5]int,target int)  {
	for i:= 0; i < len(a); i++{
		other := target - a[i]
		for j := i + 1;j < len(a); j++{
			if a[j] == other {
				fmt.Printf("(%d,%d)\n",i,j)
			}
		}
	}
	
}
func testTwoSum()  {
	b := [...]int{1,3,5,8,7}
    TwoSum(b,8)
}
func main()  {
	testTwoSum()
	
}